package com.thinkingstar.iads.projectcenter.controller;

import com.bstek.urule.runtime.KnowledgeSession;
import com.thinkingstar.iads.common.filter.GlobalsFilter;
import com.thinkingstar.iads.common.filter.UserLoginFilter;
import com.thinkingstar.iads.common.jsonUtils.AjaxResult;
import com.thinkingstar.iads.common.utils.StringUtil;
import com.thinkingstar.iads.datacenter.entity.DcManufacturerEquipmentField;
import com.thinkingstar.iads.datacenter.entity.DcProjectDesignCell;
import com.thinkingstar.iads.datacenter.entity.common.dao.CommonDao;
import com.thinkingstar.iads.datacenter.entity.dao.DaoDcProjectDesignCell;
import com.thinkingstar.iads.projectcenter.entity.PcProjectEquipmentEquip;
import com.thinkingstar.iads.projectcenter.entity.PcProjectEquipmentEquipInfo;
import com.thinkingstar.iads.projectcenter.entity.PcProjectInfo;
import com.thinkingstar.iads.projectcenter.entity.dao.DaoPcProjectData;
import com.thinkingstar.iads.projectcenter.serviceImpl.ProjectDesignManagerServiceImpl;
import com.thinkingstar.iads.test.urule.controller.RuleTool;
import org.apache.commons.lang.StringUtils;
import org.nutz.dao.Cnd;
import org.nutz.dao.QueryResult;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 项目中心相关
 * @author Administrator
 *
 */
@IocBean
@At("/projectCenter/commonupdate")
@Filters({ @By(type = GlobalsFilter.class) , @By(type = UserLoginFilter.class)})
public class CommonUpdateFieldController {
	
	private static Log log = Logs.get(); 
	
	@Inject
	private CommonDao commonDao;

	@At("/updateOneField")
	@Ok("json:full")
	public AjaxResult updateOneField(@Param("record_id") String record_id, @Param("t_name") String t_name, @Param("field_name") String field_name, @Param("value") String value) {
		if (StringUtils.isEmpty(record_id)) {
			return AjaxResult.error("记录id不能为空！");
		} else if (StringUtils.isEmpty(t_name)){
			return AjaxResult.error("表名不能为空！");
		} else if (StringUtils.isEmpty(field_name) ){
			return AjaxResult.error("字段名不能为空！");
		}
		return commonDao.updateFieldByTableAndField(record_id,t_name,field_name,value);
	}

	
}
